package cn.wolfcode.shop.cloud.common;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

public class CommonControllerAdvice {

    @ExceptionHandler
    @ResponseBody
    public Result handlerException(BusinessException e) {
        return new Result().error(e.getCodeMsg());
    }

    @ExceptionHandler
    @ResponseBody
    public Result handlerCommonException(Exception e) {
        e.printStackTrace();
        return new Result().defaultError();
    }
}
